package values;

import base.AST;
import base.Identifier;

public class PatternArray implements Value {

	AST[] values;
	int size;

	/**
	 * Creates a new pattern array with values 'values'. This is an array that either has a Value or
	 * an Identifier as its elements.
	 * 
	 * @param values
	 */

	public PatternArray(AST[] values) {
		for (int i = 0; i < values.length; i++)
			assert (values[i] instanceof Identifier || values[i] instanceof Value);

		this.values = values;
		this.size = values.length;
	}

	/**
	 * Returns the size of the array
	 * @return
	 */
	
	public int getSize() {
		return this.size;
	}
	
	/**
	 * Returns the Array of AST corresponding to this
	 * @return
	 */

	public AST[] eval() {
		return values;
	}
	
	/**
	 * Returns the AST at index 'i' of this's array
	 * @param i
	 * @return
	 */

	public AST eval(int i) {
		assert i >= 0;
		assert i < size;

		return values[i];
	}

}
